#define _CRT_SECURE_NO_WARNINGS 1
struct ListNode* ReverseList(struct ListNode* head)
{
    if (head == NULL)
        return NULL;
    if (head->next == NULL)
        return head;

    struct ListNode* slow = head;
    struct ListNode* fast = head->next;
    struct ListNode* fast_next = fast->next;

    fast->next = slow;
    slow->next = NULL;
    slow = fast;
    fast = fast_next;

    while (fast)
    {
        fast_next = fast->next;
        fast->next = slow;
        slow = fast;
        fast = fast_next;
    }
    return slow;

}